<?php

/**
 * Singleton for ...
 * 
 * This class returns the handler on ... as a Singleton object.
 * 
 * @author Oliver Schwarz <oliver.schwarz@gmail.com>
 * @package Core
 */
class TPL
{

        /**
         * Instance object
         * @access private
         * @var object
         * @static
         */
        private static $instance;
        
        /**
         * Constructor (not allowed)
         */
        private function __construct()
        {
                // no access
        }
        
        /**
         * Singleton
         * 
         * Configures (if necessary) singleton and returns the object.
         * 
         * @static
         * @return object Singleton
         */
        public static function getInstance()
        {
                if (!isset(self::$instance)):
                        self::$instance = new Smarty;
                        self::$instance->template_dir = TPL_DIR;
                        self::$instance->compile_dir = TPL_COMPILE_DIR;
                        self::$instance->force_compile = true;
                endif;
                return self::$instance;
        }

        /**
         * Disallow cloning
         */
        public function __clone()
        {
                throw new Exception('Cloning not allowed');
        } 

}

?>